<?php

class plugin_erling_kami_buy {
    private $erling_kami_nav_name = '';
    private $erling_kami_nav_position = '';

    public function __construct() {
        $configs = C::t('#erling_kami_buy#er_kami_buy_config')->fetch_by_keys([
            'nav_position','nav_name'
        ]);
        $this->erling_kami_nav_name = $configs['nav_name']['value'];
        $this->erling_kami_nav_position = $configs['nav_position']['value'];
    }

    public function global_cpnav_extra1() {
        if($this->erling_kami_nav_position == 'global_cpnav_extra1') {
            return '<a href="plugin.php?id=erling_kami_buy:user_kami_exchange">'.$this->erling_kami_nav_name.'</a>';
        }
    }

    public function global_usernav_extra3() {
        if($this->erling_kami_nav_position == 'global_usernav_extra3') {
            return '<a href="plugin.php?id=erling_kami_buy:user_kami_exchange">'.$this->erling_kami_nav_name.'</a><span style="margin:0 5px;color: #aaa;">|</span>';

        }
    }

    public function global_nav_extra() {
        if($this->erling_kami_nav_position == 'global_nav_extra') {
            return '<ul><li><a href="plugin.php?id=erling_kami_buy:user_kami_exchange">'.$this->erling_kami_nav_name.'</a></li></ul>';

        }
    }
}